package junit;

import static org.junit.Assert.*;

import java.sql.Connection;

import org.junit.Test;

import Database.DBConnecter;
import DatabaseImp.AccountDBImpl;
import DatabaseImp.ClassChoiceImpl;
import DatabaseImp.StudentDBImpl;
import DatabasePO.AccountPO;
import DatabasePO.ClassPO;
import DatabasePO.StudentPO;

public class testDBConnecter {
	

	
	@Test
	public void testAccImpl(){
		AccountDBImpl accountDBImpl = new AccountDBImpl();
		AccountPO account = accountDBImpl.queryAccount("xx", "xx");
		assertEquals("xx",account.getAccount());
	}
	
	@Test
	public void testStdImpl(){
		StudentDBImpl studentDBImpl = new StudentDBImpl();
		AccountPO accountPO = new AccountPO();
		accountPO.setAccount("xx");
		StudentPO studentPO = studentDBImpl.queryStudent(accountPO);
		assertEquals("Emmy", studentPO.getName());
	}

	@Test
	public void testInsertClassChoice(){
		StudentPO studentPO = new StudentPO();
		studentPO.setNumber("C03");
		ClassPO classPO = new ClassPO();
		classPO.setNumber("C001");
		ClassChoiceImpl choiceImpl = new ClassChoiceImpl();
		choiceImpl.insert(studentPO, classPO);
	}
}
